package com.ftg.learn.chapter13;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 *
 * 开发方式 ：
 *   三种定义方式
 *   Thread
 *      extends Thread
 *   Runnable
 *   Callable
 *
 *
 * 线程A
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/2/9 下午1:55
 */
public class AThread extends Thread {

    int a = 9;

    /**
     * 编写线程主体代码的
     */
    @Override
    public void run() {
        System.out.println(a);
    }

    public static void main(String[] args) {
        AThread a = new AThread();
        //启动线程方法
        a.start();

        ExecutorService es =  Executors.newCachedThreadPool();
        es.submit(new BRunnable(2));
        es.submit(new BRunnable(3));

        es.shutdownNow();
    }

}
